//
//  MTPostViewController.m
//  MotorTravel
//
//  Created by zk on 16/9/23.
//  Copyright © 2016年 zk. All rights reserved.
//

#import "MTPostViewController.h"
#import "MTPostTableViewCell.h"

@interface MTPostViewController ()
<
UITableViewDataSource,
UITableViewDelegate
>
@property (weak, nonatomic) IBOutlet UITableView *tableview;
@property (nonatomic, strong) NSMutableArray *postArray;

@end

@implementation MTPostViewController

#pragma mark - life cycle
- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadBaseUI];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)loadBaseUI {
    self.tableview.delegate= self;
    self.tableview.dataSource = self;
    self.tableview.tableFooterView = [UIView new];
}

#pragma mark - tableview datasource 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.postArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    MTPostTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MTPostTableViewCell"];
    return cell;
}

#pragma mark - Setter & Getter
- (NSMutableArray *)postArray {
    if (!_postArray) {
        _postArray = [[NSMutableArray alloc] init];
    }
    return _postArray;
}

@end
